def is_7num(n):

    def contains_7(n):
        while(n > 0):
            if n % 10 == 7: 
                return True
            n = n / 10
        return False

    return n % 7 == 0 or contains_7(n)


def factorial(n):
    fact = 1
    for i in range(2, n + 1):
        fact = fact * i
    return fact


def gcd(x, y):
    while y > 0:
        x = x % y
        x, y = y, x
    
    return x


def lcm(x, y):
    return (x // gcd(x, y)) * y


def is_palindromic(s):
    v = "{}".format(s)
    return v == v[::-1]


def print_all_xx_num_in(xx, begin, end, foo):
    print("All {} numbers from {} to {}:".format(xx, begin, end))

    for i in range(begin, end + 1): 
        if foo(i): 
            print(i, end=' ')


# Get user input:

m = int(input("Please input the value of m: "))
n = int(input("Please input the value of n: "))
print()

# All seven-numbers between m and n:

print_all_xx_num_in("seven-like", m, n, is_7num)
print()

# Factorials

print("{}'s factorial is: {}".format(m, factorial(m)))
print("{}'s factorial is: {}".format(n, factorial(n)))
print()

# GCD & LCM

print("The gcd of {} and {} is {}".format(m, n, gcd(m,n)))
print("The gcd of {} and {} is {}".format(m, n, lcm(m,n)))
print()

# All palindromic-numbers between m and n:

print_all_xx_num_in("palindromic", m, n, is_palindromic)
print()
